<%@ page import="com.jkt.rms.commons.includes.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.jkt.rms.business.*"%>

<%@ include file="/WEB-INF/jsp/include.jsp"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="/spring"%>

<html>
<head>
<title><fmt:message key="lbl.title.addSearchPage" /></title>
<script language="javascript"
	src="<%=PathDefinations.jsPath%>calendar.js"></script>
<script language="javascript">

<%Calendar calendar = Calendar.getInstance();

			String month = String.valueOf((calendar.get(Calendar.MONTH)) + 1);
			String date = String.valueOf(calendar.get(Calendar.DATE));
			String serverdate;
			int year = calendar.get(Calendar.YEAR);
			if (month.length() < 2) {
				month = "0" + month;
			}
			if (date.length() < 2) {
				date = "0" + date;
			}%>

	var serverdate = '<%=date + "/" + month + "/" + year%>';
</script>
</head>
<body>
<center><br>
<div id="headerbar"><fmt:message key="lbl.title.addSearchPage" /></div>
<c:if test="${ not empty errors.allErrors}">
	<div id="errorFieldSet">
	<fieldset><legend>Errors</legend> <c:forEach var="err"
		items="${errors.allErrors}">
		<spring:message code="${err.code}" arguments="${err.arguments}" />
		<br />
	</c:forEach></fieldset>
	</div>
</c:if> <c:if test="${not empty infoMsg}">
	<div id="infoFieldSet">
	<fieldset><legend>Information</legend> <c:out
		value="${infoMsg}" /></fieldset>
	</div>
</c:if>

<br>
<br>
<div id="content">
<!-- 				search project	start						 -->

<div id="headerbar"><fmt:message
	key="lbl.title.searchProjectTitle" /></div>


<div><form:form method="POST"
	action="project.htm?method=searchProjects" commandName="searchProjectVO">
	<table width="100%">
		<tr>
			<td><label>Project No :</label></td>
			<td><form:input path="projectNumber" maxlength="10" /></td>
			<td><label>Project Name :</label></td>
			<td><form:input path="projectName" maxlength="50" /></td>
		</tr>
		<tr>
			<td><label>Project Type :</label></td>
			<td><form:input path="projectType" maxlength="100" /></td>
			<td><label>Line Of Business :</label></td>
			<td><form:input path="lineOfBusiness" maxlength="100" /></td>
		</tr>
		<tr>
			<td colspan="1"><label>Status :</label></td>
			<td colspan="2"><form:select path="status">
			<form:option value="S">Select</form:option>
			<form:option value="A">All</form:option>
			<form:option value="Y">Active</form:option>
			<form:option value="N">InActive</form:option>
			</form:select>
			</td>
			<td valign="bottom" colspan="1"><input type="submit" name='Search'
				value="Search" /> <br>
			<input type="button" name='Find All' value="Find All" onclick="dosubmit('searchProjectVO','project.htm?method=searchAllProjects')"/></td>
		</tr>
	</table>
</form:form>
</div>

<c:if test="${ not empty searchResult}">
	<div id="PROJECTS" STYLE=" width: 800px; ">
	<div STYLE=" height: 200px; width: 800px; font-size: 12px; overflow: auto;">
	<fieldset><legend>PROJECTS</legend>
	<table > 
	<tr bgcolor="#AAAAAA">
		<td style="width:5pc">Project No.</td>
		<td style="width:5pc">Project Name</td>
		<td style="width:5pc">Project Type</td>
		<td style="width:5pc">Line Of Business</td>
		<td style="width:5pc">Planned Start Date</td>
		<td style="width:5pc">Planned End Date</td>
		<td style="width:5pc">Actual Start Date</td>
		<td style="width:5pc">Actual Start Date</td>
		<td style="width:5pc">Status</td>
		<td style="width:5pc">Edit</td>
	</tr>
	<c:forEach var="vo"	items="${searchResult}">
		<tr>
		<td style="width:5pc">${vo.projectNumber}</td>
		<td style="width:5pc">${vo.projectName}</td>
		<td style="width:5pc">${vo.projectType} </td>
		<td style="width:5pc">${vo.lineOfBusiness} </td>
		<td style="width:5pc"><fmt:formatDate value="${vo.projectExpectedStartDate}" pattern="${initParam.dateformat}" type="date" />  </td>
		<td style="width:5pc"><fmt:formatDate value="${vo.projectExpectedEndDate}" pattern="${initParam.dateformat}" type="date" /> </td>
		<td style="width:5pc"><fmt:formatDate value="${vo.projectActualStartDate}" pattern="${initParam.dateformat}" type="date" /> </td>
		<td style="width:5pc"><fmt:formatDate value="${vo.projectActualEndDate}" pattern="${initParam.dateformat}" type="date" /></td>
          <td style="width:5pc">${vo.status}</td>  
<!--
	<td style="width:5pc">
		<c:choose>
			<c:when test="${vo.status  eq N}" >
			     Active
		    </c:when>
				<c:otherwise>
				    InActive 
				</c:otherwise>
		</c:choose>
</td>
-->


       
          <td width="25%" align="left"> </td>   
		<td style="width:5pc"> </td>
		<td style="width:5pc"> <a href="project.htm?method=updateProjectUI&id=${vo.id}" > Edit </a>  </td>
		</tr>
	</c:forEach>
	</table>
	</fieldset>
	</div>
	</div>
</c:if> 
<br>

<br>

<!-- 				search project	end						 -->


<!-- 				add project	start					 -->


<div id="headerbar"><fmt:message key="lbl.title.addProjectTitle" /></div>


<div><br>
<form:form method="POST" action="project.htm?method=saveProject"
	commandName="addProjectVO">
	<table width="100%">
		<tr>
			<td><label>Project No*:</label></td>
			<td><form:input path="projectNumber" maxlength="10" /></td>
			<td><label>Project Type*:</label></td>
			<td><form:input path="projectType" maxlength="100" /></td>
		</tr>
		<tr>
			<td><label>Project Name*:</label></td>
			<td><form:input path="projectName" maxlength="50" /></td>
			<td><label>Purchase Order No*:</label></td>
			<td><form:input path="purchaseOrderNo" maxlength="10" /></td>
		</tr>
		<tr>
			<td><label>Project Manager*:</label></td>
			<td><form:input path="projectManager" maxlength="100" /></td>
			<td><label>Delivery Manager*:</label></td>
			<td><form:input path="deliveryManager" maxlength="100" /></td>
		</tr>
		<tr>
			<td><label>Cost Centre*:</label></td>
			<td>
			<input type='text' name='costCentre' value="" maxlength="10"/>
			</td>
			<td><label>Line Of Business*:</label></td>
			<td><form:input path="lineOfBusiness" maxlength="100" /></td>
		</tr>
		<tr>
			<td><label>Planned Start Date*:</label></td>
			<td><input type='text' name='projectExpectedStartDate' id='projectExpectedStartDate' readonly
				maxlength="10"
				value="<fmt:formatDate value="${addProjectVO.projectExpectedStartDate}" pattern="${initParam.dateformat}" type="date" />" />
				<a href="javascript:setdate('',document.getElementById('projectExpectedStartDate'))"
					class="calender"><img
					src="<%=PathDefinations.imagePath%>cal.gif" width="16"
					height="16" border="0" /></a>
			</td>
			<td><label>Planned End Date*:</label></td>
			<td><input type='text' name='projectExpectedEndDate' id='projectExpectedEndDate' readonly
				maxlength="10"
				value="<fmt:formatDate value="${addProjectVO.projectExpectedEndDate}" pattern="${initParam.dateformat}" type="date" />" />
				<a href="javascript:setdate('',document.getElementById('projectExpectedEndDate'))"
					class="calender"><img
					src="<%=PathDefinations.imagePath%>cal.gif" width="16"
					height="16" border="0" /></a>
			</td>
		</tr>
		<tr>
			<td><label>Actual Start Date:</label></td>
			<td><input type='text' name='projectActualStartDate' id='projectActualStartDate' readonly
				maxlength="10"
				value="<fmt:formatDate value="${addProjectVO.projectActualStartDate}" pattern="${initParam.dateformat}" type="date" />" />
				<a href="javascript:setdate('',document.getElementById('projectActualStartDate'))"
					class="calender"><img
					src="<%=PathDefinations.imagePath%>cal.gif" width="16"
					height="16" border="0" /></a>
				
			</td>

			<td><label>Actual End Date:</label></td>
			<td><input type='text' name='projectActualEndDate' id='projectActualEndDate' readonly
				maxlength="10"
				value="<fmt:formatDate value="${addProjectVO.projectActualEndDate}" pattern="${initParam.dateformat}" type="date" />" />
			<a href="javascript:setdate('',document.getElementById('projectActualEndDate'))"
					class="calender"><img
					src="<%=PathDefinations.imagePath%>cal.gif" width="16"
					height="16" border="0" /></a>
				
			</td>
		</tr>
		<tr>
			<td colspan="1"><label>Line of business:</label></td>
			<td colspan="2"><form:textarea cols="40" rows="5"
				path="projectDescription" onkeyup="textCounter(this,400)"/></td>
			<td valign="bottom" colspan="1"><input type="submit" name='Save'
				value="Save" /> <br> <input type="button" name='Cancel' value="Cancel" /></td>
		</tr>
	</table>
</form:form></div>
<p></p>
<br>
</div>

<!-- 				add project	end					 -->


<%@ include file="footer.jsp"%></center>
</body>
</html>
